/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jjsoft.disco.gco.mdl;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Johnny
 */
@Entity
@Table(catalog = "discodb", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Cobro.findAll", query = "SELECT c FROM Cobro c"),
    @NamedQuery(name = "Cobro.findByIdcobro", query = "SELECT c FROM Cobro c WHERE c.idcobro = :idcobro"),
    @NamedQuery(name = "Cobro.findByValor", query = "SELECT c FROM Cobro c WHERE c.valor = :valor"),
    @NamedQuery(name = "Cobro.findByFecha", query = "SELECT c FROM Cobro c WHERE c.fecha = :fecha")})
public class Cobro implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(nullable = false)
    private Integer idcobro;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(precision = 22)
    private Double valor;
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecha;
    @JoinColumn(name = "idUsuario", referencedColumnName = "idusuario")
    @ManyToOne
    private Usuario idUsuario;
    @JoinColumn(name = "idFactura", referencedColumnName = "numero")
    @ManyToOne
    private Factura idFactura;
    @JoinColumn(name = "idDiario", referencedColumnName = "iddiario")
    @ManyToOne
    private Diario idDiario;

    public Cobro() {
    }

    public Cobro(Integer idcobro) {
        this.idcobro = idcobro;
    }

    public Integer getIdcobro() {
        return idcobro;
    }

    public void setIdcobro(Integer idcobro) {
        this.idcobro = idcobro;
    }

    public Double getValor() {
        return valor;
    }

    public void setValor(Double valor) {
        this.valor = valor;
    }

    public Date getFecha() {
        return fecha;
    }

    public void setFecha(Date fecha) {
        this.fecha = fecha;
    }

    public Usuario getIdUsuario() {
        return idUsuario;
    }

    public void setIdUsuario(Usuario idUsuario) {
        this.idUsuario = idUsuario;
    }

    public Factura getIdFactura() {
        return idFactura;
    }

    public void setIdFactura(Factura idFactura) {
        this.idFactura = idFactura;
    }

    public Diario getIdDiario() {
        return idDiario;
    }

    public void setIdDiario(Diario idDiario) {
        this.idDiario = idDiario;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idcobro != null ? idcobro.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Cobro)) {
            return false;
        }
        Cobro other = (Cobro) object;
        if ((this.idcobro == null && other.idcobro != null) || (this.idcobro != null && !this.idcobro.equals(other.idcobro))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.jjsoft.disco.gco.mdl.Cobro[ idcobro=" + idcobro + " ]";
    }
    
}
